how to write animation in matplotlib